package com.jysz.certificate.persistence.model.cs;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.jysz.certificate.persistence.enums.cs.OptionStatus;
import com.jysz.certificate.persistence.model.cm.Certification;
import com.jysz.webcore.ssh.entity.AbstractBaseEntity;

/**
 * 盘库单-合格证
 * @author xuxiaolong
 */
@Entity
@Table(name="cs_checkstock_option_")
@org.hibernate.annotations.Entity
public class CheckStockOption extends AbstractBaseEntity<Long> {
	
	private static final long serialVersionUID = 7334137609006755998L;

	/** 盘库单*/
	private CheckStock  checkStock;

	/** 合格证*/
	private Certification certification;
	
	/** 合格证状态*/
	private OptionStatus cfStatus;
	
	/** 车辆状态*/
	private OptionStatus carStatus;

	/** 合格证状态-区域经理*/
	private OptionStatus cfStatusArea;
	
	/** 车辆状态-区域经理*/
	private OptionStatus carStatusArea;
	
	/** 备注*/
	private String remark;

	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "_checkstock_id", insertable=true, updatable=true)
	@Type(type = "Long")
	public CheckStock getCheckStock() {
		return checkStock;
	}

	public void setCheckStock(CheckStock checkStock) {
		this.checkStock = checkStock;
	}

	@ManyToOne(fetch = FetchType.LAZY,cascade=CascadeType.REFRESH)  
	@JoinColumn(name = "_certification_id",insertable=true, updatable=true,columnDefinition="bigint(20)")
	public Certification getCertification() {
		return certification;
	}

	public void setCertification(Certification certification) {
		this.certification = certification;
	}

	@Column(name= "_cf_status",nullable=true,columnDefinition="int(11)")
	public OptionStatus getCfStatus() {
		return cfStatus;
	}

	public void setCfStatus(OptionStatus cfStatus) {
		this.cfStatus = cfStatus;
	}

	@Column(name= "_car_status",nullable=true,columnDefinition="int(11)")
	public OptionStatus getCarStatus() {
		return carStatus;
	}

	public void setCarStatus(OptionStatus carStatus) {
		this.carStatus = carStatus;
	}
	
	@Column(name= "_cf_status_area",nullable=true,columnDefinition="int(11)")
	public OptionStatus getCfStatusArea() {
		return cfStatusArea;
	}

	public void setCfStatusArea(OptionStatus cfStatusArea) {
		this.cfStatusArea = cfStatusArea;
	}

	@Column(name= "_car_status_area",nullable=true,columnDefinition="int(11)")
	public OptionStatus getCarStatusArea() {
		return carStatusArea;
	}

	public void setCarStatusArea(OptionStatus carStatusArea) {
		this.carStatusArea = carStatusArea;
	}

	@Column(name= "_remark",nullable=true,columnDefinition="varchar(255)")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	public boolean equals(Object obj){
		CheckStockOption cs=(CheckStockOption) obj;
		if(this.getId()==cs.getId())
			return true;
		return false;
	}

}
